function a(a, t, r) {
  return t in a ? Object.defineProperty(a, t, {
    value: r,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : a[t] = r, a;
}

var t = function(a) {
    return a && a.__esModule ? a : {
      default: a
    };
  }(require("../../../../utils/toot.js")),
  r = require("../../../../utils/wxcharts.js"),
  e = getApp(),
  o = null;

Page({
  data: {
    curHdIndex: 2,
    areaChartArr: [],
    id: 0,
    targetIndex: 0,
    importantData:[
      {
        nmIndexLis: '心脏',
        nmQuantiUnit: '2018-11-02',
        limitLow: 30,
        limitHigh: 40
      }
    ]
  },
  touchHandler: function(a) {
    for (var t = a.target.id, r = "", e = this.data.areaChartArr, o = 0; o < e.length; o++)
      if (e[o].opts.canvasId == t) {
        r = o;
        break;
      }
    this.data.areaChartArr[r].scrollStart(a);
  },
  moveHandler: function(a) {
    for (var t = a.target.id, r = "", e = this.data.areaChartArr, o = 0; o < e.length; o++)
      if (e[o].opts.canvasId == t) {
        r = o;
        break;
      }
    this.data.areaChartArr[r].scroll(a);
  },
  touchEndHandler: function(a) {
    for (var t = a.target.id, r = "", e = this.data.areaChartArr, o = 0; o < e.length; o++)
      if (e[o].opts.canvasId == t) {
        r = o;
        break;
      }
    this.data.areaChartArr[r].scrollEnd(a), this.data.areaChartArr[r].showToolTip(a);
  },
  onLoad: function(a) {
    // console.log(a);
    // var r = this,
    //   n = wx.getStorageSync("flag") || "";
    // r.setData({
    //   teamId: a.teamId || "",
    //   flag: n
    // });
    // var i = wx.getStorageSync("patientId") + "_" + wx.getStorageSync("log") + r.data.teamId,
    //   d = this,
    //   s = a.cdEmItem;
    // t.default.getEmItem(a, d);
    // var l = 320;
    // try {
    //   l = wx.getSystemInfoSync().windowWidth, d.setData({
    //     windowWidth: l
    //   });
    // } catch (a) {
    //   console.error("getSystemInfoSync failed!");
    // }
    // wx.setNavigationBarTitle({
    //   title: d.data.nmEmItem + "-重要指标变化图"
    // }), 
    // wx.request({
    //   url: e.globalData.patient + "patient/report/listImportant/" + i + "/" + s + "/" + n,
    //   success: function(a) {
    //     if (console.log(a), 200 == a.data.code) {
    //       d.data.targetIndex;
    //       0;
    //       var t = a.data.data;
    //       if (!t) return void d.setData({
    //         canvasFlag: !0
    //       });
    //       for (var r in t) {
    //         a.data.data;
    //         var n = [],
    //           i = [],
    //           s = r,
    //           l = 0,
    //           c = 10,
    //           u = d.data.areaChartArr;
    //         t[r].forEach(function(a) {
    //           l = parseFloat(a.limitLow) || 0, c = parseFloat(a.limitHigh) || 10, "" != a.valueLis && (i.push(parseFloat(a.valueLis)),
    //             n.push(e.getDate(a.dateEm)));
    //         }), o = d.chartList(s, d.data.windowWidth, n.reverse(), i.reverse(), l, c, s);
    //         for (var h = 0; h < u.length; h++)
    //           if (u[h].opts.canvasId == r) return u[h] = o,
    //             d.setData({
    //               areaChartArr: u
    //             }), console.log(u), void wx.hideLoading();
    //         u.push(o), d.setData({
    //           areaChartArr: u
    //         });
    //       }
    //       d.setData({
    //         importantData: t,
    //         canvasFlag_top: !0
    //       });
    //     }
    //     console.log(d.data.importantData);
    //   }
    // });
    let that = this;
    let aa = {
      nmIndexLis: '1',
      nmQuantiUnit: '1',
      limitLow: '1',
      limitHigh: '2'
    };
    let b = [aa];
    that.setData({
      // importantData: b,
      canvasFlag_top: !0
    })
  },
  chartList: function(t, e, o, n, i, d, s) {
    return new r(a({
      canvasId: t,
      type: "line",
      categories: o,
      animation: !0,
      series: [{
        maxValue: 11,
        minValue: 3,
        name: s,
        data: n,
        format: function(a) {
          return a.toFixed(2);
        }
      }],
      yAxis: {
        format: function(a) {
          return a.toFixed(2);
        },
        min: i,
        max: d,
        fontColor: "#999999",
        gridColor: "#f0f0f0"
      },
      xAxis: {
        fontColor: "#999999",
        disableGrid: !0
      },
      extra: {
        legendTextColor: "red"
      },
      dataLabel: !1,
      width: e,
      height: 190
    }, "extra", {
      lineStyle: "curve"
    }));
  },
  onReady: function(e) {
    // 使用 wx.createContext 获取绘图上下文 context
    var context = wx.createCanvasContext('abc');
    context.setStrokeStyle("#00ff00")
    context.setLineWidth(5)
    context.stroke()
    context.setStrokeStyle("#ff0000")
    context.setLineWidth(2)
    context.arc(0, 200, 10, 0, 0, )
    context.arc(0, 100, 40, 0, 0, )
    context.arc(0, 100, 40, 0, 0, )
    context.arc(0, 80, 80, 0, 0, )
    context.arc(0, 80, 80, 0, 0, )
    context.arc(0, 60, 120, 0, 0, )
    context.arc(0, 60, 120, 0, 0, )
    context.arc(0, 150, 160, 0, 0, )
    context.arc(0, 150, 160, 0, 0, )
    context.arc(0, 100, 200, 0, 0, )
    context.arc(0, 100, 200, 0, 0, )
    context.arc(0, 200, 240, 0, 0, )
    context.stroke()
    context.draw()
  }
});